<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
  <script>
  var info = {//对象是一种数据结构
    name:"why",

    running:function(name) {
      console.log("running~",this.name)//先看一下自己的作用域找有没有name,没有就去WIndow对象里面找
    },

    eating: function(name) {
      console.log("eating~",this.name)//封装的比较独立，不会因为外部条件的改变而受到影响
    },
    studying:function(name) {
      console.log("studying~",this.name)
    }
  }

  info.eating()
  info.running()
  info.studying()
  </script>
</body>
</html>